package com.atao.view;

import java.io.File;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends Activity implements OnClickListener {
	private MyViewSwitcher myViewSwitcher;
	Button bt;
	ProductListLinearLayout plll;
	public static int width;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        width=this.getWindowManager().getDefaultDisplay().getWidth();
        setContentView(R.layout.main);
        try {
			myViewSwitcher = (MyViewSwitcher) findViewById(R.id.home_imageswitcher);
			myViewSwitcher.initView(3,2000);
			ImageView iv1=new ImageView(this);
			iv1.setImageResource(R.drawable.b);
			myViewSwitcher.chageContent(iv1, 0);
			Thread.sleep(100);
			ImageView iv2=new ImageView(this);
			iv2.setImageResource(R.drawable.c);
			myViewSwitcher.chageContent(iv2, 1);
			Thread.sleep(100);
			bt=(Button) findViewById(R.id.bt01);
			bt.setOnClickListener(this);
			plll=(ProductListLinearLayout) findViewById(R.id.plll);
			plll.initData();
		} catch (Exception e) {
			e.printStackTrace();
		}
    }
    String ids[]=null;
    class MyAsyncTask extends AsyncTask<String, Void, File>{

		@Override
		protected File doInBackground(String... params) {
			File file=new File("");
			for(String id:ids){
				params[0]="d";
			}
			return file;
		}
    	@Override
    	protected void onPostExecute(File file) {
    		changViewSwitchImage(file);
    	}
    }
    public void changViewSwitchImage(File file){
    	Bitmap bitmap=BitmapFactory.decodeFile(file.toString());
    	ImageView iv2=new ImageView(this);
    	iv2.setImageBitmap(bitmap);
		myViewSwitcher.chageContent(iv2, 1);
    }
	@Override
	public void onClick(View v) {
		plll.setVisibility(View.VISIBLE);
	}
    
}